package clases_dao;

import java.sql.Connection;
import java.sql.SQLException;

import model.Persona;

import com.mysql.jdbc.Statement;

public class Chofer_Dao {
	
	private Connect conexion;
	
	public Chofer_Dao () {}
	
	public boolean guardar (Persona chofer) throws SQLException{
		conexion = new Connect();
		Connection con=conexion.getConnection();
		
		String sql = "INSERT INTO persona VALUES (null, '"+chofer.getNombre()+"', '"+chofer.getApellido()+"', "
				+chofer.getDni()+",'"+chofer.fecNacToString()+"', '"+chofer.getNacionalidad()+"', '"+chofer.getDomicilio()+"'"+ ", '"
				+chofer.getLocalidad()+"', '"+chofer.getCuil()+"', '"+chofer.getEstadoCivil()+"', "
				+chofer.getCodPostal()+", '"+chofer.getSexo()+"' )";
		
		Statement statement =  (Statement) con.createStatement();
		boolean r= statement.execute(sql);
		
		conexion.closeConnection();
		
		return r;
	}

}
